package hku.cs.lunuo.rank;

import org.jdom.Element;

public class StmtResultUnit implements Comparable {
	String klassName;
	int ln;
	int rank=-1;
	Label label;
	
	

	public String getKlassName() {
		return klassName;
	}

	public int getLn() {
		return ln;
	}
	
	public int getRank() {
		return rank;
	}

	@Override
	public int compareTo(Object o) {
		StmtResultUnit sru = (StmtResultUnit) o;
		return this.label.compareTo(sru.label);
	}

	public StmtResultUnit(String klassName, int ln, Label label) {
		super();
		this.klassName = klassName;
		this.ln = ln;
		this.label = label;
	}

	
	public void toXML(Element xmlStmt) {
		xmlStmt.setAttribute("class", this.klassName);
		xmlStmt.setAttribute("line", Integer.toString(this.ln));
		this.label.toXML(xmlStmt);
		Element el = new Element("rank");
		el.setText(String.valueOf(rank));
		xmlStmt.addContent(el);
	}

}
